package vaccine.appointment.system.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 逻辑删除枚举类
 */
@Getter
@AllArgsConstructor
public enum DelFlgEnum {
    NOT_DELETED(0, "没有删除"),
    DELETED(1, "已删除");

    private final int code;
    private final String description;

    /**
     * 根据名称获取枚举对象
     * @param name 名称
     * @return 枚举对象
     */
    public static DelFlgEnum forName(String name) {
        for(DelFlgEnum delFlgEnum : DelFlgEnum.values()) {
            if(delFlgEnum.name().equalsIgnoreCase(name)) {
                return delFlgEnum;
            }
        }
        return null;
    }
}
